import { MediaMessageContent  } from "wukongimjssdk";
const code = 3;
export class MsgVoiceContent extends MediaMessageContent  {
  url!: string; // 音频链接
  duration!: string; // 音频时长

  constructor() {
    super();
    this.contentType = code;
  }

  // 解码
  decodeJSON(content: any) {
    this.url = content["url"];
    this.duration = content["duration"];
  }
  // 编码
  encodeJSON() {
    // console.log("encodeJSON >>", this.url, this.duration, this);
    return {
      url: this.url,
      duration: this.duration,
    };
  }
}

export default {
  // 消息类型名称
  name: "msg-voice",
  // 消息类型编码
  code: code,
  // 消息类型内容
  content: MsgVoiceContent,
};
